﻿using BCCommon.FreightEnums;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
//using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace BCEntity.MongoDB.Location
{
    /// <summary>
    /// 车辆位置轨迹
    /// </summary>
    public class LocationVehicleEntity
    {
        private double longitude;
        private double latitude;

        [BsonId]
        /// <summary>
        /// kafka临时消息Id
        /// </summary>
        [BsonElement("TemplateMessageId")]
        public string TemplateMessageId { get; set; }
        /// <summary>
        /// 车辆Id
        /// </summary>
        [BsonElement("VehicleId")]
        public long VehicleId { get; set; }
        /// <summary>
        /// 主司机Id
        /// </summary>
        [BsonElement("MainDriverId")]
        public long MainDriverId { get; set; }
        /// <summary>
        /// 司机Id
        /// </summary>
        [BsonElement("DriverId")]
        public long DriverId { get; set; }

        /// <summary>
        /// 车牌号
        /// </summary>
        [BsonElement("VehicleNo")]
        public string VehicleNo { get; set; }
        /// <summary>
        /// 车型Id
        /// </summary>
        [BsonElement("VehicleTypeId")]
        public int VehicleTypeId { get; set; }
        /// <summary>
        /// 车型名称
        /// </summary>
        [BsonElement("VehicleTypeName")]
        public string VehicleTypeName { get; set; }
        /// <summary>
        /// 车型所属类型
        /// </summary>
        [BsonElement("VehicleTypeEnum")]
        public string VehicleTypeEnum { get; set; }
        /// <summary>
        /// 车型所属类型中文
        /// </summary>
        [BsonElement("VehicleTypeEnumValue")]
        public string VehicleTypeEnumValue { get; set; }
        /// <summary>
        /// 车型分类--枚举值
        /// </summary>
        [BsonElement("VehicleCategory")]
        public string VehicleCategory { get; set; }
        /// <summary>
        /// 车型分类中文
        /// </summary>
        [BsonElement("VehicleCategoryValue")]
        public string VehicleCategoryValue { get; set; }
        /// <summary>
        /// 位置更新时间
        /// </summary>
        [BsonElement("ModifyTime")]
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime ModifyTime { get; set; }
        /// <summary>
        /// 所在位置精度
        /// </summary>
        [BsonElement("Longitude")]
        public double Longitude { get { return this.longitude; } set { this.longitude = Math.Round(value, 8); } }
        /// <summary>
        /// 所在位置维度
        /// </summary>
        [BsonElement("Latitude")]
        public double Latitude { get { return this.latitude; } set { this.latitude = Math.Round(value, 8); } }
        /// <summary>
        /// 所在位置精维度
        /// </summary>
        [BsonElement("Coordinate")]
        public double[] Coordinate { get; set; }
        /// <summary>
        /// 接受零担推送
        /// </summary>
        [BsonElement("ReceivePartLoad")]
        public bool ReceivePartLoad { get; set; }
        /// <summary>
        /// 车辆信用分
        /// </summary> 
        [BsonElement("CreditPoints")]
        public decimal CreditPoints { get; set; }
        /// <summary>
        /// 接单数
        /// </summary>
        [BsonElement("ReceivedOrders")]
        public int ReceivedOrders { get; set; }
        /// <summary>
        /// 车辆状态
        /// </summary>
        [BsonElement("VehicleStatus")]
        public VehicleRunningStatus VehicleStatus { get; set; }
        /// <summary>
        /// 车辆状态
        /// </summary>
        [BsonElement("VehicleStatusStr")]
        public string VehicleStatusStr { get; set; }
        /// <summary>
        /// 已申请休假
        /// </summary>
        [BsonElement("IsHoliday")]
        public bool IsHoliday { get; set; }
        /// <summary>
        /// 休假开始时间
        /// </summary>
        [BsonElement("HolidayStartTime")]
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime? HolidayStartTime { get; set; }
        /// <summary>
        /// 休假结束时间
        /// </summary>
        [BsonElement("HolidayEndTime")]
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime? HolidayEndTime { get; set; }
        /// <summary>
        /// 休假备注
        /// </summary>
        [BsonElement("HolidayRemark")]
        public string HolidayRemark { get; set; }
        /// <summary>
        /// 当日拒单次数
        /// </summary>
        [BsonElement("TodayRejectOrderCount")]
        public int TodayRejectOrderCount { get; set; }
        /// <summary>
        /// 是否首次出车
        /// </summary>
        [BsonElement("IsFirstWork")]
        public bool IsFirstWork { get; set; }

        /// <summary>
        /// 司机姓名
        /// </summary>
        [BsonElement("DriverName")]
        public string DriverName { get; set; }

        /// <summary>
        /// GPS IMEI号
        /// </summary>
        [BsonElement("GpsImei")]
        public string GpsImei { get; set; }


        /// <summary>
        /// 不在线
        /// </summary>
        [BsonElement("OffLine")]
        public bool OffLine { get; set; }

    }
}
